<?php
    include './connect.php';
    if($_GET["select"]=="brand"){
        $strSQL="select BrandId,Brand from brand order by Brand";
        $sqlQuery=  mysqli_query($MechanicDB, $strSQL);
        $result = array();
        while ($row = $sqlQuery->fetch_assoc()){
            $result[]=$row;
        }
        echo json_encode($result);
        return false;
    }else if($_GET["select"]=="supplier"){
        $strSQL="SELECT `SupplierCode`, `SupplierName` FROM `supplier` order by SupplierName";
        $sqlQuery=  mysqli_query($MechanicDB, $strSQL);
        $result = array();
        while ($row = $sqlQuery->fetch_assoc()){
            $result[]=$row;
        }
        echo json_encode($result);
        return false;
    }else if($_GET["select"]=="job"){
        $strSQL="SELECT `JobId`, `Job` FROM `job` order by Job";
        $sqlQuery=  mysqli_query($MechanicDB, $strSQL);
        $result = array();
        while ($row = $sqlQuery->fetch_assoc()){
            $result[]=$row;
        }
        echo json_encode($result);
        return false;
    }else if($_GET["select"]=="location"){
        $strSQL="SELECT `LocationId`, `Location` FROM `location` order by Location";
        $sqlQuery=  mysqli_query($MechanicDB, $strSQL);
        $result = array();
        while ($row = $sqlQuery->fetch_assoc()){
            $result[]=$row;
        }
        echo json_encode($result);
        return false;
    }
?>
